<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

/*Route::get('/', function () {
    return view('welcome');
});*/


// Route::group(['middleware'=>['mylimit','throttle:10,1']],function (){
//     Route::get('/', function () {
//         return view('welcome');
//     });
// });


// 登录
Route::get('login','LoginController@index')->name('login');
Route::post('login','LoginController@login')->name('login');
// 列表展示
// Route::get('/','UserController@index')->name('index');
// 路由绑定中间件
// Route::get('/','UserController@index')->name('index')->middleware('ck');
// 路由分组绑定中间件
Route::group(['middleware'=>['ck']],function(){
    Route::get('index','UserController@index')->name('index');
});
// 添加显示
Route::get('add','UserController@add')->name('add');
// 添加处理
Route::post('add','UserController@save')->name('add');
// 修改显示
Route::get('edit/{id}','UserController@edit')->name('edit');
// 修改处理
Route::put('update/{id}','UserController@update')->name('update');
// 删除单条
Route::delete('del/{id}','UserController@del')->name('del');
// 删除多条
Route::delete('deleteAll','UserController@deleteAll')->name('deleteAll');

Route::get('session',function(){
    // 设置
    session(['username'=> 'HA47']);
    session(['password'=>'123456']);
    // 判断  返回true/false 
    // dump(session()->has('username'));
    // 读取
    // dump(session('username2','不存在'));
    // dump(session('username'));
    dump(session()->all());
    // 删除
    // session()->forget('username');
    // dump(session()->all());
    // 删除全部
    session()->flush();
    dump(session()->all());
});